#include <SDL.h>
#include <sysutil/sysutil_msgdialog.h>

void						msgCallback					(int aButtonType, void* aUserData)
{
	if(aButtonType != CELL_MSGDIALOG_BUTTON_NONE)
	{
		*(int*)aUserData = aButtonType;
	}
}

static uint32_t				MSG_Internal				(const char* aMessage, uint32_t aType)
{
	int button = 0;

	cellMsgDialogOpen2(CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL | aType, 
			aMessage, msgCallback, &button, 0);

	while(!button)
	{
		SDL_Flip(SDL_GetVideoSurface());
		SDL_PumpEvents();
		cellSysutilCheckCallback();
	}

	cellMsgDialogClose(0);

	return button;
}

uint32_t					MSG_YesNo					(const char* aMessage)
{
	return CELL_MSGDIALOG_BUTTON_YES == MSG_Internal(aMessage, CELL_MSGDIALOG_TYPE_BUTTON_TYPE_YESNO);
}

void						MSG_Normal					(const char* aMessage)
{
	MSG_Internal(aMessage, CELL_MSGDIALOG_TYPE_BUTTON_TYPE_OK);
}


